I think the #EUref was partly a mid term chance to kick Cameron for austerity. USA mid terms often go against incumbent.
The EU was never popular or properly understood in the UK. Many believe it to be corrupt bureaucratic and anti democratic, when it is not so different to the equivalent UK institutions. What's democratic about the monarch or the House of Lords?
People blamed traffic, housing shortages and lack of school places on the free movement of EU citizens when it was largely govt policy at fault.
People are free to move around the UK as well, causing more strain on the SE and less on areas with fewer jobs. Sensible govts would encourage more jobs in these areas. The EU does this, the U.K. doesn't.
Some think 52% voted for racism, actually I think leave would have got more votes if they hadn't morphed towards UKIP.
GE15 was won by clever targeting by the Tories, fraud and scaremongering. No surprise to see similar in #EUref
Leave cleverly used a handful of Labour MPs to give the impression it was cross party when it was mostly Tories.